home *** CD-ROM | disk | FTP | other *** search
/ Amiga Inside! / Amiga FD Inside (1995)(Ultramax).iso / berndspd / devtools / intuigen / examples / gtmultireq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-22  |  5.7 KB  |  353 lines

  1. #include <stddef.h>
  2. #include <stdlib.H>
  3. #include <stdio.H>
  4. #include <exec/exec.h>
  5. #include <intuition/intuition.h>
  6. #include <intuition/screens.h>
  7. #include <intuition/gadgetclass.h>
  8. #include <intuition/imageclass.h>
  9. #include <intuition/classusr.h>
  10. #include <intuition/icclass.h>
  11. #include <libraries/asl.h>
  12. #include <libraries/commodities.h>
  13. #include <rexx/storage.h>
  14. #include <rexx/simplerexx.h>
  15. #include <libraries/gadtools.h>
  16. #include <workbench/startup.h>
  17. #include <workbench/icon.h>
  18. #include <utility/tagitem.h>
  19. #include <clib/exec_protos.h>
  20. #include <clib/intuition_protos.h>
  21. #include <clib/alib_protos.h>
  22. #include <clib/asl_protos.h>
  23. #include <clib/commodities_protos.h>
  24. #include <clib/dos_protos.h>
  25. #include <clib/wb_protos.h>
  26. #include <clib/icon_protos.h>
  27. #include <clib/utility_protos.h>
  28. #include <IntuiGen/EditList.h>
  29.  
  30. #include <IntuiGen/GTRequest.h>
  31.  
  32. struct GTReqSet {
  33.     struct List List;
  34.     struct MsgPort *MsgPort;
  35. };
  36.  
  37. void Click(struct GTRequest *req,struct IntuiMessage *msg,
  38.              struct GTControl *gtc,struct MessageHandler *mh)
  39. {
  40.     puts(gtc->NewGadget->ng_GadgetText);
  41. }
  42.  
  43. void mCloseWindow(struct GTRequest *req,struct IntuiMessage *msg,
  44.             struct GTControl *gtc,struct MessageHandler *mh)
  45. {
  46.     EndGTRequest(req,1,mh,gtc);
  47. }
  48.  
  49. struct NewMenu Req1Menus[] =
  50. {
  51.     { NM_TITLE, "Project1", 0, 0, 0, 0 },
  52.     {  NM_ITEM, "Open1", 0, NULL, 0, 0 },
  53.     {  NM_ITEM, "Close1", 0, NULL, 0, 0 },
  54.     { NM_END, NULL, 0, 0, 0, 0 }
  55. };
  56.  
  57. struct TextAttr TextAttributes0 =
  58. {
  59.     "topaz.font",
  60.     TOPAZ_EIGHTY,
  61.     NULL,
  62.     FPF_ROMFONT
  63. };
  64.  
  65. struct TagItem Click1Tags[]=
  66. {
  67.     {  GT_Underscore,'_'  },
  68.     {  TAG_DONE,0  }
  69. };
  70.  
  71. struct NewGadget NewClick1=
  72. {
  73.     23,19,
  74.     68,13,
  75.     (UBYTE *)"Click1",
  76.     &TextAttributes0,
  77.     0,
  78.     0,
  79.     0,
  80.     0
  81. };
  82.  
  83. struct MessageHandler Click1GadgetUpMH =
  84. {
  85.     NULL,
  86.     "GadgetUp",
  87.     NULL,
  88.     Click
  89. };
  90.  
  91. struct GTControl Click1 =
  92. {
  93.     NULL,
  94.     BUTTON_KIND,
  95.     INITFROMDATA | STOREDATA,
  96.     Click1Tags,
  97.     NULL,
  98.     &NewClick1,
  99.     NULL,
  100.     &Click1GadgetUpMH,
  101.     '',
  102.     0,
  103.     0,
  104.     0,0,
  105.     NULL,
  106.     NULL,
  107.     NULL,
  108.     0,0,
  109.     0,
  110.     0,
  111.     NULL,
  112.     NULL,
  113.     NULL,
  114.     NULL,
  115.     NULL,
  116.     NULL,
  117.     NULL
  118. };
  119.  
  120. struct TagItem NewWin1Tags[]=
  121. {
  122.     {  WA_Left, 84    },
  123.     {  WA_Top, 64  },
  124.     {  WA_InnerWidth, 117  },
  125.     {  WA_InnerHeight, 44  },
  126.     {  WA_IDCMP,
  127.         IDCMP_GADGETUP | IDCMP_CLOSEWINDOW | IDCMP_MENUPICK  },
  128.     {  WA_Title, "Window 1"  },
  129.     {  WA_MinWidth, 123  },
  130.     {  WA_MinHeight, 57  },
  131.     {  WA_MaxWidth, 123  },
  132.     {  WA_MaxHeight, 57  },
  133.     {  WA_AutoAdjust, 1  },
  134.     {  WA_Flags,
  135.         WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_SMART_REFRESH |
  136.     WFLG_ACTIVATE  }
  137. };
  138.  
  139. void Open1(struct GTRequest *req,struct IntuiMessage *msg)
  140. {
  141.     puts("Open1");
  142. }
  143.  
  144. void Close1(struct GTRequest *req,struct IntuiMessage *msg)
  145. {
  146.     puts("Close1");
  147. }
  148.  
  149. struct GTMenuInfo Req1GTMenuInfo[] =
  150. {
  151.     { 0 | (0 << 5) | (63 << 11), Open1 },
  152.     { 0 | (1 << 5) | (63 << 11), Close1 },
  153.     { 0, 0 }
  154. };
  155.  
  156. struct MessageHandler Req1CloseWindowMH =
  157. {
  158.     NULL,
  159.     "CloseWindow",
  160.     NULL,
  161.     mCloseWindow
  162. };
  163.  
  164. struct GTRequest Req1 =
  165. {
  166.     NewWin1Tags,
  167.     NULL,        /* Window */
  168.     Req1Menus,        /* Menus */
  169.     Req1GTMenuInfo,     /* MenuInfo */
  170.     &Click1,        /* Controls */
  171.     INITFROMDATA | STOREDATA,        /* Flags */
  172.     NULL,        /* RequestTags */
  173.     NULL,        /* Borders */
  174.     NULL,        /* Images */
  175.     NULL,        /* ITexts */
  176.     NULL,        /* InitFunc */
  177.     0,
  178.     NULL,
  179.     NULL,        /* DataStruct */
  180.     NULL,        /* EndFunction */
  181.     NULL,        /* LoopFunction */
  182.     0,0,        /* CallLoop, LoopBitsUsed */
  183.     0,0,        /* AdditionalSignals, SignalFunction */
  184.     NULL,        /* LocalMsgClassList */
  185.     NULL,        /* LocalPKindCassList */
  186.     &Req1CloseWindowMH, /* MsgHandlerList */
  187.     NULL,
  188.     NULL,
  189.     NULL,
  190.     NULL,
  191.     NULL,
  192.     NULL,
  193.     NULL,
  194.     NULL,
  195.     NULL
  196. };
  197.  
  198. struct NewMenu Req2Menus[] =
  199. {
  200.     { NM_TITLE, "Project2", 0, 0, 0, 0 },
  201.     {  NM_ITEM, "Open2", 0, NULL, 0, 0 },
  202.     {  NM_ITEM, "Close2", 0, NULL, 0, 0 },
  203.     { NM_END, NULL, 0, 0, 0, 0 }
  204. };
  205.  
  206. struct TagItem Click2Tags[]=
  207. {
  208.     {  GT_Underscore,'_'  },
  209.     {  TAG_DONE,0  }
  210. };
  211.  
  212. struct NewGadget NewClick2=
  213. {
  214.     41,22,
  215.     68,13,
  216.     (UBYTE *)"Click2",
  217.     &TextAttributes0,
  218.     0,
  219.     0,
  220.     0,
  221.     0
  222. };
  223.  
  224. struct MessageHandler Click2GadgetUpMH =
  225. {
  226.     NULL,
  227.     "GadgetUp",
  228.     NULL,
  229.     Click
  230. };
  231.  
  232. struct GTControl Click2 =
  233. {
  234.     NULL,
  235.     BUTTON_KIND,
  236.     INITFROMDATA | STOREDATA,
  237.     Click2Tags,
  238.     NULL,
  239.     &NewClick2,
  240.     NULL,
  241.     &Click2GadgetUpMH,
  242.     '',
  243.     0,
  244.     0,
  245.     0,0,
  246.     NULL,
  247.     NULL,
  248.     NULL,
  249.     0,0,
  250.     0,
  251.     0,
  252.     NULL,
  253.     NULL,
  254.     NULL,
  255.     NULL,
  256.     NULL,
  257.     NULL,
  258.     NULL
  259. };
  260.  
  261. struct TagItem Newwin2Tags[]=
  262. {
  263.     {  WA_Left, 365  },
  264.     {  WA_Top, 145    },
  265.     {  WA_InnerWidth, 138  },
  266.     {  WA_InnerHeight, 49  },
  267.     {  WA_IDCMP,
  268.         IDCMP_GADGETUP | IDCMP_CLOSEWINDOW | IDCMP_MENUPICK  },
  269.     {  WA_Title, "Window 2"  },
  270.     {  WA_MinWidth, 144  },
  271.     {  WA_MinHeight, 62  },
  272.     {  WA_MaxWidth, 144  },
  273.     {  WA_MaxHeight, 62  },
  274.     {  WA_AutoAdjust, 1  },
  275.     {  WA_Flags,
  276.         WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET | WFLG_SMART_REFRESH |
  277.     WFLG_ACTIVATE  }
  278. };
  279.  
  280.  
  281. void Open2(struct GTRequest *req,struct IntuiMessage *msg)
  282. {
  283.     puts("Open2");
  284. }
  285.  
  286. void Close2(struct GTRequest *req,struct IntuiMessage *msg)
  287. {
  288.     puts("Close2");
  289. }
  290.  
  291. struct GTMenuInfo Req2GTMenuInfo[] =
  292. {
  293.     { 0 | (0 << 5) | (63 << 11), Open2 },
  294.     { 0 | (1 << 5) | (63 << 11), Close2 },
  295.     { 0, 0 }
  296. };
  297.  
  298. struct MessageHandler Req2CloseWindowMH =
  299. {
  300.     NULL,
  301.     "CloseWindow",
  302.     NULL,
  303.     mCloseWindow
  304. };
  305.  
  306. struct GTRequest Req2 =
  307. {
  308.     Newwin2Tags,
  309.     NULL,        /* Window */
  310.     Req2Menus,        /* Menus */
  311.     Req2GTMenuInfo,     /* MenuInfo */
  312.     &Click2,        /* Controls */
  313.     INITFROMDATA | STOREDATA,        /* Flags */
  314.     NULL,        /* RequestTags */
  315.     NULL,        /* Borders */
  316.     NULL,        /* Images */
  317.     NULL,        /* ITexts */
  318.     NULL,        /* InitFunc */
  319.     0,
  320.     NULL,
  321.     NULL,        /* DataStruct */
  322.     NULL,        /* EndFunction */
  323.     NULL,        /* LoopFunction */
  324.     0,0,        /* CallLoop, LoopBitsUsed */
  325.     0,0,        /* AdditionalSignals, SignalFunction */
  326.     NULL,        /* LocalMsgClassList */
  327.     NULL,        /* LocalPKindCassList */
  328.     &Req2CloseWindowMH,  /* MsgHandlerList */
  329.     NULL,
  330.     NULL,
  331.     NULL,
  332.     NULL,
  333.     NULL,
  334.     NULL,
  335.     NULL,
  336.     NULL,
  337.     NULL
  338. };
  339.  
  340. main()
  341. {
  342.     struct GTReqSet rs;
  343.  
  344.     InitReqSet(&rs);
  345.  
  346.     AddGTRequest(&rs,&Req1);
  347.     AddGTRequest(&rs,&Req2);
  348.  
  349.     ProcessReqSet (&rs);
  350.     return 0;
  351. }
  352.  
  353.